<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/WEB-INF/view/console/common/css.html"){}	%>
 <% include("/WEB-INF/view/console/common/js.html"){} 	%>
  <!-- 配置文件 -->
  <script type="text/javascript" src="${ctxPath}/plugin/utf8-jsp/ueditor.config.js"></script>
  <!-- 编辑器源码文件 -->
  <script type="text/javascript" src="${ctxPath}/plugin/utf8-jsp/ueditor.all.js"></script>
 <title></title>
 </head>
 <body> <nav class="navbar navbar-default navbar-fixed-top site-navbar" >
  <div class="navbar-header">
 <a class="navbar-brand" href="#">boMessage</a>
 </div>
  </nav>
 <form name="boMessage_form"  id="boMessage_form" class="form-horizontal" style="margin-top: 60px;">
   <div class="form-group">
 <label for="cemail" class="control-label col-sm-2">消息类型</label>
 <div class="col-sm-6">
 	<select class="form-control" id="messageType"
 		name="messageType" check-type="required">
 	<option selected='selected' value="1">官方推送</option>
 </select>
 </div>
 </div>
 	<script type="text/javascript">
   $(function($) {
 	$("#messageType").val("${boMessage.messageType!}");
 	if('${boMessage.messageType!}'==''){
 	    $("#messageType").val('1');
 	}
    });
 	</script>
  <div class="form-group" >
   <label class="col-sm-2 control-label">消息标题</label>
   <div class="col-sm-6">
    <input  type="text"  name="messageTitle" id="messageTitle" class="form-control" check-type="required" value='${boMessage.messageTitle!}' >
   </div>
  </div>
  <div class="form-group" >
   <label class="col-sm-2 control-label">消息内容</label>
   <div class="col-sm-6">
    <!-- 加载编辑器的容器 -->
    <script id="messageContent" name="messageContent" type="text/plain">
         ${boMessage.messageContent!}
    </script>
    <script type="text/javascript">
        UE.getEditor('messageContent');
    </script>
   </div>
  </div>
   <input type='hidden' name='id' id='id' value='${boMessage.id!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 <div class="form-group" style="margin-bottom: 60px;"></div>
 </form>
 <script type="text/javascript">
 $(function($) {
    /*开启表单验证*/
 	$("#boMessage_form").validation();
 });
 /*保存*/
 function saveZqForm(){
    if ($("#boMessage_form").valid() == false) {
 	    return false;
    }
    var formObject=new Object();
    formObject.messageType=$('#messageType').val()==''?null:$('#messageType').val(); 
 formObject.messageContent=UE.getEditor('messageContent').getContent();
 formObject.messageTitle=$('#messageTitle').val()==''?null:$('#messageTitle').val(); 
 formObject.id=$('#id').val()==''?null:$('#id').val(); 
 
    var formObjectJson = JSON.stringify(formObject);
    $.post("${ctxPath}/console/bo_message/save",
     {
           formObjectJson :formObjectJson,
 	   table_name :'boMessage',
 	   common_token :$("#common_token").val()
     }, function(data) {
            $.confirm({
                title: '提示',
                content: data.message,
                autoClose: 'cancelAction|3000',
                escapeKey: 'cancelAction',
                buttons: {
                    cancelAction: {
                        text: '确定',
                        action: function () {
                            parent.$("#boMessage").bootstrapTable("refresh");
                            parent.art.dialog.get('id-dialog-boMessage').close();
                        }
                    }
                }
            });
     });
 }
 </script>
 <nav class="navbar navbar-default navbar-fixed-bottom site-navbar" >
 <div class="container" style="padding-top:10px;padding-bottom:10px;">
 <div class="nav navbar-nav navbar-right">
 <a href="#" class="btn btn-success"  onclick='saveZqForm()'>保存 </a>
  </div>
  </div>
  </nav>
 </body>
